1. Field of the Invention
The present invention relates to a program counter circuit, that is, a circuit that generates, to control the order of execution of a group of instructions, an address indicating a storage location of an arbitrary instruction code that is stored in a storage medium.
2. Background Art
In general, to cause a prescribed circuit to operate according to a prescribed program, a group of instruction codes representing various unit instructions are stored in advance in a storage medium such as a ROM, RAM, or a register. Control is made in such a manner that instruction codes are designated in order that is prescribed by the program and are input to the circuit. Instruction codes are designated by specifying addresses indicating their storage locations. The program counter circuit is a circuit for generating such addresses and outputting those as program counter values (PC values).
Usually, an instruction code contains a PC value of an instruction code to be executed next. Conventional program counter circuits choose one of a first PC value that is counted up one for each clock pulse and a second PC value that is contained in an instruction code that has been executed immediately before, and output it as the next PC value. This enables an operation that while as a general rule instruction codes in a storage medium are executed in order of their storage locations, the storage medium is accessed randomly when necessary such as a jump to an arbitrary instruction code or repeated execution of part of the instruction codes (refer to Japanese Patent Laid-Open No. 161899/1998 (page 5 and FIG. 1)).
However, in conventional program counter circuits, in the case of random access, the steps of outputting a PC value, reading a PC value that is contained in an instruction code that is specified by the output PC value, and outputting it as the next PC value are executed. Therefore, in the case of random access, a delay of one or more clock cycles always occurs as compared to the case of outputting PC values that are produced by simple, one-by-one counting-up.